/**数据连接*/
/**
 *   安装 mysql 模块
 *   cnpm install mysql --save
 * */

var mysql = require('mysql')

var connection = mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'123456',
    database:'demo'
})

connection.connect();



connection.query("select * from user",function (error,results,field) {
    console.log(results);
    console.log(results[0].username);
})

connection.end();